/*
 * Copyright 2008-2023 dexian.vip. All rights reserved.
 * Support: http://www.dexian.vip
 * License: http://www.dexian.vip/license
 */

package vip.dexian.common.query;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

/**
 * 范围查询
 *
 * @author 挺好的 2023年05月30日 18:43
 */
@Data
@EqualsAndHashCode (callSuper = false)
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public abstract class BaseBetween<L, U> {

    /**
     * 左边的值
     */
    private L lowerBound;

    /**
     * 右边的值
     */
    private U upperBound;

    /**
     * 是否有效
     *
     * @return 左右两边的值为null，返回false。否则返回true
     */
    public boolean isValid () {
        return this.lowerBound != null && this.upperBound != null;
    }

    @Override
    public String toString () {
        return "lowerBound:" + this.lowerBound + ",upperBound:" + this.upperBound;
    }
}
